﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	Filter.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Entities
{
	/// <summary>
	/// Generic filter
	/// </summary>
	public class Filter
	{
		/// <summary>
		/// Filter query builder
		/// </summary>
		public IQueryBuilder<IFilterExecutor> Query { get; protected set; }

		/// <summary>
		/// Filter executor
		/// </summary>
		public IFilterExecutor Executor { get; protected set; }

		public Filter(MetaFields meta)
		{
			Query = new CamlQueryBuilder<IFilterExecutor>(meta, new FilterExecutor());

			Query.Executor.Query = Query;

			Executor = Query.Executor;
		}

		/// <summary>
		/// Return query builder
		/// </summary>
		public virtual IQueryBuilder GetQueryBuilder()
		{
			return Query;
		}
	}
}